﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace nadModel.pad
{
    public partial class JobProcess : AbstractEntityProcess
    {
        public string conection_addr = "http://nad.nadfinlo.com.cn/nad/";
        public JobEntity[] FindByParameter(JobParameter p)
        {
            string sql = " select * from " + JobEntity.DB_TABLES + " where company='" + p.company + "' "
                           + " and (" + JobEntity.JOB_COMPLETE + "='" + (p.JobComplete ? 1 : 0) + "' ) "
                           + " and (" + JobEntity.ANALYSIS_CODE + "='REWORK' or '" + (p.AnalysisCode ? 1 : 0) + "'='0' )"
                           + " and (" + JobEntity.PART_NUM + "='" + p.PartNum + "' or '" + p.PartNum + "'='' )"
                           + " and (" + JobEntity.JOBCOMPLETION_DATE + ">='" + p.CompleteDateFrom + "' or '" + (p.JobComplete ? p.CompleteDateFrom : "") + "'='' )"
                           + " and (" + JobEntity.JOBCOMPLETION_DATE + "<='" + p.CompleteDateTo + "' or '" + (p.JobComplete ? p.CompleteDateTo : "") + "'='' )"
                           + " and (" + JobEntity.CREATE_DATE + ">='" + p.CreateDateFrom + "' or '" + p.CreateDateFrom + "'='' )"
                           + " and (" + JobEntity.CREATE_DATE + "<='" + p.CreateDateTo + "' or '" + p.CreateDateTo + "'='' )"
                           + " and (" + JobEntity.JC_DEPT + "='" + p.JCDept + "' or '" + p.JCDept + "'='' )"
                           + " and (" + JobEntity.OP_CODE + "='" + p.opCode + "' or '" + p.opCode + "'='' )"
                           + " and (" + JobEntity.JOB_NUM + " in('" + p.JobNum + "' )or '" + p.JobNum + "'=''  )";
            JobEntity[] ents = (JobEntity[])FindBySql(sql,conection_addr);
            return ents;
        }


    }
}
